<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        body {
            font-family: 'Courier New', Courier, monospace;
            font-size: 30px;
        }

        #container {
            width: max-content;
            margin: 0 auto;
            background-color: rgb(243, 255, 175);
            padding: 20px 100px
        }
        .up{
            color:blue;
        }
        .down{
            color:red;
        }
    </style>

</head>

<body>
    <div id="container"></div>
    <script>
        // 定义一个函数用于生成图形
        function generateShape() {
            let totalStars =7;
            temp='';
            for(let i=1;i<=5;i++){
                temp+="<span class='up'>"+'&nbsp'.repeat(5-i)+'*'.repeat(i*2-1)+"</span>"+"<br>";
            }
            for(let i=5;i>=1;i--){
                temp+="<span class='down'>"+'&nbsp'.repeat(5-i)+'*'.repeat(i*2-1)+"</span>"+"<br>";
            }
            return temp;
        }
        res=generateShape();
        console.log(res);
        a=document.getElementById("container");
        a.innerHTML+=res;
    </script>
    
</body>

</html>